<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<button onclick="oppenBaidu()">打开百度</button>
<button onclick="closeWindow()">关闭百度</button>
<script type="text/javascript">
    console.log(window.innerWidth)
    var window1
    function oppenBaidu() {
        window1 = window.open("http://www.baidu.com");
    }
    function closeWindow() {
        window1.close()
    }
</script>
</body>
</html>